home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_15_1987_Transactor_Publishing.d64 / eprom prg 64 (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  6KB  |  222 lines

  1. 1 rem** program by tim bolbach / graphics by rich bozman **
  2. 2 poke56835,128:poke56834,254:poke57091,255:poke53281,11:poke53280,0
  3. 3 rv$=chr$(18): sp$=rv$+"                            "
  4. 4 co=36:li=24:gosub260:print chr$(147)chr$(144)
  5. 7 fort=1 to 21
  6. 9 next t
  7. 12 poke2020,195
  8. 13 poke2021,195
  9. 14 poke2022,195
  10. 15 poke2023,253
  11. 17 print"[147]"spc(9)"eprom handler menu"
  12. 19 print"    1 list eprom on screen"
  13. 20 print"    2 program eprom"
  14. 21 print"    3 write eprom to disk"
  15. 22 print"    4 verify eprom with disk"
  16. 23 print"    5 check for erasure"
  17. 24 print"    6 directory"
  18. 25 print"    7 list disk file to screen"
  19. 26 print"       logo [146] = commodore key"
  20. 27 poke198,0:wait198,1:geta$
  21. 28 a=val(a$):ifa<1ora>7then27
  22. 29 onagoto30,62,101,138,182,214,240
  23. 30 rem *** read eprom ***
  24. 31 c$="0123456789abcdef"
  25. 33 print"[147]"spc(8)"list eprom on screen"
  26. 35 print"shift=pause[146]  shift lock=hold[146]  logo=menu"
  27. 36 a=0:poke56835,128:poke57091,255:rem**** set ports for read ******
  28. 37 poke56834,254
  29. 38 ad=a
  30. 39 gosub 54
  31. 40 print rv$;"$";a$;":[146] ";
  32. 41 for t=0 to 7
  33. 42 ah=int((ad+t)/256):al=(ad+t)-(ah*256)
  34. 43 poke56832,al :poke56833,ah
  35. 44 poke 56834,8
  36. 45 d=peek(57089)
  37. 46 poke56834,254
  38. 47 gosub 59
  39. 48 print d$;" ";
  40. 49 next t
  41. 50 print
  42. 51 onpeek(653)goto51,2
  43. 52 a=a+8
  44. 53 goto 38
  45. 54 d1=int(a/4096):x=a-(d1*4096)
  46. 55 d2=int(x/256):x=x-(d2*256)
  47. 56 d3=int(x/16):d4=x-(d3*16)
  48. 57 a$=mid$(c$,d1+1,1)+mid$(c$,d2+1,1)+mid$(c$,d3+1,1)+mid$(c$,d4+1,1)
  49. 58 return
  50. 59 d1=int(d/16):d2=d-(d1*16)
  51. 60 d$=mid$(c$,d1+1,1)+mid$(c$,d2+1,1)
  52. 61 return
  53. 62 rem *** burn eprom ***
  54. 63 print"[147]";:poke56835,128:poke56834,254:poke57091,128
  55. 65 print spc(13)"burn eprom"
  56. 67 gosub 1000
  57. 75 x=((2^a)*1024)-1
  58. 76 input"file name";n$
  59. 77 open8,8,8,n$+",p,r"
  60. 78 open15,8,15
  61. 79 get#15,a$,b$
  62. 80 er=val(a$+b$)
  63. 81 print"";a$+b$;
  64. 82 get#15,a$:printa$;:ifa$=chr$(13)then84
  65. 83 goto82
  66. 84 ifer>0thenclose8:close15: fort=1 to 1000:next t:goto2
  67. 85 printspc(7)"press key when ready":poke198,0:wait198,1
  68. 86 get#8,a$:get#8,a$:rem ** get rid of file address ***
  69. 87 poke56834,255:fort=1 to 1000:nextt
  70. 88 printspc(12)"location:":printspc(13)"logo = abort"
  71. 89 forc=0 to x:li=19:co=21:gosub260:
  72. 90 printleft$(sp$,7-len(str$(c)))c
  73. 91 get#8,d$:ifd$=""thend$=chr$(0)
  74. 92 d=asc(d$)
  75. 93 ah=int(c/256):al=c-(ah*256)
  76. 94 poke56832,al:poke56833,ah
  77. 95 poke57089,d
  78. 96 poke56834,5
  79. 97 poke56834,255
  80. 98 ifpeek(653)=2thenc=x
  81. 99 next c
  82. 100 poke56834,254:poke57091,255:close8:close15:goto2
  83. 101 rem *** write eprom to disk ***
  84. 102 print"[147]";:poke56835,128:poke56834,254:poke57091,255
  85. 104 print spc(9)"write eprom to disk"
  86. 106 gosub 1000
  87. 114 x=((2^a)*1024)-1
  88. 115 input"file name";n$
  89. 116 open8,8,8,n$+",p,w"
  90. 117 open15,8,15
  91. 118 get#15,a$,b$
  92. 119 er=val(a$+b$):printa$;b$;
  93. 120 get#15,a$:printa$;:ifa$=chr$(13)then122
  94. 121 goto120
  95. 122 ifer>0thenclose8:close15: fort=1 to 1000:next t:goto2
  96. 123 printspc(7)"press key when ready":poke198,0:wait198,1
  97. 124 poke56834,254:fort=1 to 400:nextt
  98. 125 printspc(12)"location:":printspc(13)"logo = abort"
  99. 126 print#8,chr$(0);:print#8,chr$(0); :rem ** put in fake file address **
  100. 127 forc=0 to x:li=18:co=21:gosub260:
  101. 128 printleft$(sp$,7-len(str$(c)))c
  102. 129 ah=int(c/256):al=c-(ah*256)
  103. 130 poke56832,al:poke56833,ah
  104. 131 poke56834,8
  105. 132 d=peek(57089)
  106. 133 poke56834,254
  107. 134 d$=chr$(d):print#8,d$;
  108. 135 ifpeek(653)=2thenc=x
  109. 136 nextc
  110. 137 poke56834,254:poke57091,255:close8:close15:goto2
  111. 138 rem *** verify eprom with disk ***
  112. 139 print"[147]";:poke56835,128:poke56834,254:poke57091,255
  113. 141 print"[147]"spc(7)"verify eprom with disk"
  114. 143 gosub 1000
  115. 151 x=((2^a)*1024)-1
  116. 152 input"file name";n$
  117. 153 open8,8,8,n$+",p,r"
  118. 154 open15,8,15
  119. 155 get#15,a$,b$
  120. 156 er=val(a$+b$):printa$;b$;
  121. 157 get#15,a$:printa$;:ifa$=chr$(13)then159
  122. 158 goto157
  123. 159 ifer>0thenclose8:close15: fort=1 to 1000:next t:goto2
  124. 160 printspc(7)"press key when ready":poke198,0:wait198,1
  125. 161 poke56834,254:fort=1 to 400:nextt
  126. 162 printspc(12)"location:":printspc(13)"logo = abort"
  127. 163 get#8,a$:get#8,a$:rem ** get fake file address out of the way*
  128. 164 forc=0 to x
  129. 165 li=18:co=21:gosub260:
  130. 166 printleft$(sp$,7-len(str$(c)))c
  131. 167 ah=int(c/256):al=c-(ah*256)
  132. 168 poke56832,al:poke56833,ah
  133. 169 poke56834,8
  134. 170 d=peek(57089):print"  "left$(sp$,5-len(str$(d)))
  135. 171 poke56834,254
  136. 172 get#8,a$:ifa$=""thena$=chr$(0)
  137. 173 a=asc(a$):ifa<>d then 180
  138. 174 ifpeek(653)=2thenc=x
  139. 175 next c
  140. 176 poke56834,254:poke57091,255:close8:close15:goto2
  141. 177 print"[147] eprom program verified [146]"
  142. 178 printspc(4)"press any key to continue":poke198,0:wait198,1
  143. 179 close8:close15:goto2
  144. 180 print"[147]      !!! error found !!!            ";
  145. 181 printspc(4)"the error is at location :[146]"c:goto178
  146. 182 rem *** check for erasure ***
  147. 184 print"[147]"spc(13)"check erasure"
  148. 186 a=0:poke56835,128:poke57091,255:rem* set ports for read *
  149. 187 poke56834,254
  150. 188 gosub 1000
  151. 196 poke56834,254
  152. 197 x=((2^a)*1024)-1
  153. 198 printspc(8)"press key when ready":poke198,0:wait198,1
  154. 199 printspc(12)"location:":printspc(13)"logo = abort"
  155. 200 forc=0 to x
  156. 201 if peek(653)=2 thenc=x:goto210
  157. 202 li=15:co=21:gosub260:
  158. 203 printleft$(sp$,7-len(str$(c)))c
  159. 204 ah=int(c/256):al=c-(ah*256)
  160. 205 poke56832,al:poke56833,ah
  161. 206 poke56834,8
  162. 207 d=peek(57089)
  163. 208 poke56834,254
  164. 209 if d<>255 then 212
  165. 210 next c:ifd<>255then212
  166. 211 printspc(8)"eprom erased":goto213
  167. 212 printspc(7)"eprom is not erased !!"
  168. 213 printspc(9)"press key for menu":poke198,0:wait198,1:goto2
  169. 214 rem *** directory ***
  170. 216 print"[147]"spc(12)"disk directory"
  171. 218 print"      shift=pause[146]"spc(9)"logo=menu[146]"
  172. 219 open1,8,0,"$0"
  173. 220 get#1,a$,b$
  174. 221 get#1,a$,b$
  175. 222 get#1,a$,b$
  176. 223 c=0:u$=""
  177. 224 if a$<>"" then c=asc(a$+chr$(0))
  178. 225 if b$<>"" then c=c+asc(b$+chr$(0))*256
  179. 226 printright$(sp$,9-len(str$(c)))c" ";
  180. 227 get#1,b$:if st<>0 then 237
  181. 228 if b$<>chr$(34) then 227
  182. 229 get#1,b$:if b$<>chr$(34)thenu$=u$+b$:b$="":goto229
  183. 230 get#1,b$:if b$=chr$(32) then230
  184. 231 printchr$(34)u$right$(sp$,16-len(u$))chr$(34)" ";:c$=""
  185. 232 c$=c$+b$:get#1,b$:if b$<>""  then232
  186. 233 printleft$(c$,3)
  187. 234 ifpeek(653)=1then234
  188. 235 ifpeek(653)=2thenclose1:goto2
  189. 236 if st=0 then 221
  190. 237 print" blocks free"
  191. 238 printspc(11)"press key for menu":poke198,0:wait198,1
  192. 239 close1:goto 2
  193. 240 rem **** display disk file ******
  194. 242 print"[147]"spc(9)"display disk file"
  195. 244 print"    shift=pause[146]"spc(9)"logo=menu"
  196. 245 h$="0123456789abcdef"
  197. 246 input" file name[146]";n$
  198. 247 open8,8,8,n$+",p,r"
  199. 248 get#8,a$:get#8,a$
  200. 249 for t= 0 to 8191
  201. 250 for r= 0 to 7
  202. 251 get#8,a$:ifa$=""thena$=chr$(0)
  203. 252 d=asc(a$)
  204. 253 q=int(d/16):w=d-(q*16)
  205. 254 d$=mid$(h$,q+1,1)+mid$(h$,w+1,1)
  206. 255 printd$;"  ";
  207. 256 next r
  208. 257 if peek (653)=2 then close8:goto2
  209. 258 if peek (653)=1 then 258
  210. 259 print:next t
  211. 260 poke211,co:poke214,li:sys58732:return
  212. 270 :
  213. 1000 print"select eprom size"
  214. 1010 print"    1   2k"
  215. 1020 print"    2   4k"
  216. 1030 print"    3   8k"
  217. 1040 print"    4  16k"
  218. 1050 print"    5  32k"
  219. 1060 poke198,0:wait198,1
  220. 1070 geta$:a=val(a$):ifa<1ora>5then1060
  221. 1080 return
  222.